package com.hbmcc.heshenghuo.util

import android.content.Context
import android.graphics.Color
import android.graphics.Typeface
import android.text.Spannable
import android.text.SpannableStringBuilder
import androidx.databinding.BindingAdapter
import android.widget.TextView
import android.text.style.AbsoluteSizeSpan
import android.text.style.StyleSpan
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.hbmcc.heshenghuo.R
import com.hbmcc.heshenghuo.view.WaveView

/**
 * @author 支豪亮
 * @date 2021/8/12 4:21 下午
 * @des TextView dataBinding 适配器
 */
object WaveViewAttrAdapter {

    @JvmStatic
    @BindingAdapter("isFrist")
    fun startColor(waveView: WaveView, isFrist:Boolean) {
        if(isFrist){
            waveView.setStartColor(Color.parseColor("#FFDFE7FF"))
            waveView.setEndColor(Color.parseColor("#FF6A5AE6"))
            waveView.setBackgroundResource(R.mipmap.ic_flow_container_one)
        }else{
            waveView.setStartColor(Color.parseColor("#FFDFEEFF"))
            waveView.setEndColor(Color.parseColor("#FF2265E1"))
            waveView.setBackgroundResource(R.mipmap.ic_flow_container_two)
        }

    }

    @JvmStatic
    @BindingAdapter("ratio")
    fun setRatio(waveView: WaveView, ratio:String?) {
        waveView.setContainerRatio(if(ratio.isNullOrEmpty()) 0F else ratio.toFloat())
    }





}